package com.dragon.utilslibrary.tools;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class MyScheduledExecutorService {

    private static ScheduledExecutorService service = null;
    private static ExecutorService exeService = null;

    public static ScheduledExecutorService getService() {
        if (service == null) {
            synchronized (MyScheduledExecutorService.class) {
                if (service == null) {
                    service = Executors.newSingleThreadScheduledExecutor();
                }
            }
        }
        return service;
    }

    public static ExecutorService newThreadScheduledExecutor() {
        if (exeService == null) {
            synchronized (MyScheduledExecutorService.class) {
                if (exeService == null) {
                    exeService = Executors.newCachedThreadPool();
                }
            }
        }
        return exeService;
    }
    
}
